import random
input_file='input.txt'
n=random.randint(2,14)
m=random.randint(1,100000)
seq=[]
with open(input_file,'w') as f:
    f.write(f"{n} {m}\n")
    for i in range(m):
        e_cnt= random.randint(0,min(i,100))
        f.write(f"{i} {e_cnt} ")
        for j in range(e_cnt):
            rd_index=j+random.randint(0,len(seq)-j-1)
            seq[j],seq[rd_index]=seq[rd_index],seq[j]
            f.write(f"{seq[j]} ")
        cal_cost=random.randint(1,1000000000)
        trans_cost=random.randint(1,10000000)
        f.write(f"{cal_cost} {trans_cost}\n")
        seq.append(i)